package com.joysuch.wwyt.dynamicdata.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * 描述：异常状态类型枚举<br>
 *
 * @author jingwk<br>
 * @version 1.0 <br>
 * 日期:2021年12月01日 上午10:57:00
 */
public enum ComponentTypeEnum {
    INPUT("input", "单行文本"),
    TEXTAREA("textarea", "多行文本"),
    DROP_DOWN_SELECT("drop_down_select", "下拉选项"),
    SELECT_TARGET("select_target", "选择目标");


    private String value;

    private String desc;

    ComponentTypeEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public final String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    private static final Map<String, ComponentTypeEnum> lookup = new HashMap<>();

    private static final Map<String, String> KV = new HashMap<>();

    static {
        for (ComponentTypeEnum e : EnumSet.allOf(ComponentTypeEnum.class)) {
            lookup.put(e.value, e);
            KV.put(e.getDesc(),e.value);
        }
    }

    public static ComponentTypeEnum find(String value) {
        return lookup.get(value);
    }

    public static Map<String, String> getKV() {
        return KV;
    }
}
